obj = {
    d: console.log,
    name: "NameInObj",
    data: {
        name: "nameIndataOfobj",
        age: 18
    },

    methodInObj: function () {
        console.log(this.data.name);
        console.log(this.data.age);
        this.d(this.data);
        // console.log(name);

    },
    /* 定义函数的若干种方式: */
    m1: function () {
        console.log("I am the method1😎");

    },
    /* 简化写法m1:将`: */
    m2() {
        console.log("I am the method2❤️");
    }
    ,
    /* 测试箭头函数的对象绑定特性 */
    testThis() {
        const that = this;
        setTimeout(
            function () {
                console.log(this.name + " 😎test this within setTimeOut(expected undefined)");
            }
        );
        setTimeout(
            function () {
                console.log(that.name + " 😎test this within setTimeOut(expected name in obj)");
            }
        );
        setTimeout(() => {
            console.log(this.name + ` 👌test that within settimeOut(expected name in obj) `);
        }, 0);
    }
};


function testmethod() {

    obj.methodInObj;
    obj.methodInObj();
    console.log(obj.methods);
}
// console.log(obj.methods());
// console.log(obj);

function testMn() {
    obj.m1();
    obj.m2();
}
// testMn()

obj.testThis();
